<?php
/**
 * Created by PhpStorm.
 * User: Qch
 * Date: 2018/9/11
 * Time: 12:00
 */

namespace Application\Admin\Controller;


use J\Schema\Syntax;
use J\Intent;
use J\MVC\Controller;

class ModuleController extends Controller
{
    protected function beforeCore()
    {
        parent::beforeCore();
        $this->enableAdmin(self::AUTH_SUPER);
    }

    protected function optionElementUIIndex(Intent $intent)
    {
        $intent->value = [
            'view' => [
                'name' => Syntax::DISPLAY_MODULE,
                'item' => [
                    'label' => '模块设计',
                    'holder' => 'item-group',
                    'name' => 'module',
                    'items' => [
                        [
                            'index' => 'module-name',
                            'label' => '模块名',
                            'name' => 'name',
                        ],
                        [
                            'index' => 'module-controllers',
                            'label' => '控制器列表',
                            'name' => 'controllers',
                            'holder' => 'item-group',
                            'asArray' => true,
                            'items' => [
                                [
                                    'index' => 'controller-name',
                                    'label' => '控制器名',
                                    'name' => 'name',
                                ],
                            ]
                        ],
                        [
                            'index' => 'module-models',
                            'label' => '模型列表',
                            'name' => 'collections',
                            'holder' => 'item-group',
                            'asArray' => true,
                            'items' => [
                                [
                                    'index' => 'model-name',
                                    'label' => '模型名',
                                    'name' => 'name',
                                ],
                            ]
                        ]
                    ]
                ],
                'url' => '/Api.php/Admin/Module/Make'
            ]
        ];
    }

    protected function optionApiMake(Intent $intent)
    {}
}